package com.cy.module.dingtalk.mobility;

import com.cy.ext.plugin.route.ControllerBind;
import com.cy.model.User;
import com.cy.module.WebApiController;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

@ControllerBind(controllerKey = "/clmp/dingtalk/mobility/user")
public class UserController extends WebApiController {

    @Override
    public void index() {
    }

    public void getUser(){
        String mobile = getPara("mobile");
        Map<String, Object> result = new HashMap<>(2);
        if (StringUtils.isBlank(mobile)){
            result.put("status", 0);
            result.put("msg", "参数为空");
            renderJson(result);
            return;
        }
        User user = User.dao.findByMobile(mobile);
        if (user != null){
            result.put("status", 1);
            result.put("user", user);
        } else {
            result.put("status", 0);
            result.put("msg", "无此用户");
        }
        renderJson(result);
    }
}
